<template>
	<view class="warp">
		<!-- 顶部 start -->
		<!-- #ifdef WEB -->
		<view class="navbar_top">
			<uv-navbar leftText="返回" :fixed="false" title="考试结果" border :safeAreaInsetTop="false" :placeholder="true" @leftClick="jumpUrl('1','navigateBack')" @rightClick="jumpUrl('/pages/index/index','redirectTo')">
				<template v-slot:left>
					<view class="uv-nav-slot">
						<uv-icon name="arrow-left" size="19"></uv-icon>
					</view>
				</template>
				<template v-slot:right>
					<view class="uv-nav-slot">
						<uv-icon name="home" size="19"></uv-icon>
					</view>
				</template>
			</uv-navbar>
		</view>
		<uv-gap height="44" bgColor="#F1F1F5"></uv-gap>
		<!-- #endif -->
		<!-- #ifdef MP-WEIXIN -->
		<uv-navbar leftText="返回" :fixed="true" title="考试结果" border :safeAreaInsetTop="true" :placeholder="true" @leftClick="jumpUrl('1','navigateBack')" @rightClick="jumpUrl('/pages/index/index','redirectTo')">
			<template v-slot:left>
				<view class="uv-nav-slot">
					<uv-icon name="arrow-left" size="19"></uv-icon>
				</view>
			</template>
			<template v-slot:right>
				<view class="uv-nav-slot">
					<uv-icon name="home" size="19"></uv-icon>
				</view>
			</template>
		</uv-navbar>
		<!-- #endif -->
		<!-- 顶部 end -->
		
		<view class="test_end">
			<view class="img">
				<image :src="IMG_URL + 'test02.png'" mode="aspectFit"></image>
			</view>
			<view class="test_title">
				{{row.test_title}}
			</view>
			<view class="test_warp">
				<view class="test_card">
					<view class="test_card_i card_i_1">
						<view class="test_weigh">姓名：</view>
						<view class="test_value">{{row.nickname}}</view>
					</view>
					<view class="test_card_i card_i_2">
						<view class="test_weigh">成绩：</view>
						<view class="test_value" v-if="row.test_status == 1">{{row.score}}</view>
						<view class="test_value" v-else style="color:chocolate;">待批阅...</view>
					</view>
					<view class="test_card_i card_i_2" v-if="row.test_status == 1">
						<view class="test_weigh">状态：</view>
						<view class="test_value" style="color:chocolate;" v-if="row.is_pass == 0">不及格</view>
						<view class="test_value" v-else>及格</view>
					</view>
					<view class="test_card_i card_i_2">
						<view class="test_weigh">提交时间：</view>
						<view class="test_value">{{row.createtime}}</view>
					</view>
				</view>
				<view class="test_card_btn" v-if="row.is_retake == 1" @click="jumpUrl(`/pages/test/details?id=${row.test_id}&start_retake=1`,'redirectTo')">
					开始复考
				</view>
				<view class="test_card_btn test_card_btn2" @click="jumpUrl(`/pages/test/show?id=${id}&test_id=${row.test_id}`)">
					查看试卷
				</view>
			</view>
			
		</view>
		<!-- 底部tabbar start -->
		<bastTabbar :tabbar_index="1000"></bastTabbar>
		<!-- 底部tabbar end -->
	</view>
</template>

<script>
	import bastTabbar from '@/component/base-tabbar.vue'
	export default {
		components: {
			bastTabbar,
		},
		onLoad(options) {
			this.id = options.id
			this.getRow()
		},
		data() {
			return {
				id: '',
				row: {},
				IMG_URL: this.$IMG_URL,
			}
		},
		methods: {
			async getRow() {
				const res = await this.$myRequest({
					url: "test/test_result",
					type: "post",
					data: {id:this.id}
				});
				if(res.code){
					this.row = res.data
				}
			},
		}
	}
</script>

<style lang="scss">
	.warp{
		background-color: #FFF;
		min-height: 100vh;
		max-width: 1600rpx;
		margin: auto;
		color: #333;
		.navbar_top{
			z-index: 1000;background-color: red;position: relative;
			.uv-navbar{
				position: fixed;
				width: 100%;
				max-width: 1600rpx;
			}
		}
		
		// 试卷盒子
		.test_box{
			margin: 20rpx 0;
			.test_title{
				text-align: center;
			}
			.test_block{
				padding: 20rpx;
				font-size: 28rpx;
				.block_title{
					font-size: 30rpx;
					color: #1688f1;
					font-weight: bold;
					.score_desc{
						font-size: 24rpx;
						color: crimson;
					}
				}
				// 题目 start
				.block_question{
					margin-left: 1em;
					.question_item{
						margin-top: 40rpx;
						.question_title{
							.text_key{
								margin-right: 20rpx;
								font-weight: bold;
							}
							.text_title{}
						}
						// 填空题标题样式
						.tkt_question_title{
							display: flex;
							flex-wrap: wrap;
							.text_key{
								display: inline;
								margin-right: 20rpx;
								font-weight: bold;
							}
							.text_title{
								display: flex;
								flex-wrap: wrap;
								align-items: center;
								.title_list{
									.tkt_box{
										margin: 0 10rpx;
									}
								}
							}
						}
						.answer_list{
							display: flex;
							flex-wrap: wrap;
							margin-top: 20rpx;
							margin-left: 1em;
							.answer_item{
								margin: 10rpx 0;
								box-sizing: border-box;
								margin-right: 100rpx;
								display: flex;
								align-items: center;
								cursor: pointer;
								.answer_key{
									font-weight: bold;
									margin-right: 14rpx;
									display: flex;
									align-items: center;
									.answer_key_icon{
										margin-right: 8rpx;
									}
								}
								.radio_img{
									width: 34rpx;
									height: 34rpx;
									margin-right: 10rpx;
								}
							}
						}
						.pd_answer_list{
							display: block;
						}
					}
				}
				// 题目 end
			}
			.input_btn{
				margin: 20rpx auto;
				height: 80rpx;
				line-height: 80rpx;
				width: 95%;
				text-align: center;
				font-size: 28rpx;
				border-radius: 8rpx;
				color: #fff;
				background-color: #1688f1;
			}
		}
		.test_success{
			width: 100vw;
			text-align: center;
		}
		.test_end{
			// width: 100vw;
			text-align: center;
			.img {
				image{
					margin-top: 40rpx;
					width: 300rpx;
					height: 300rpx;
				}
			}
			.test_msg{
				margin-top: 40rpx;font-size: 30rpx;text-align: center;color: #1688f1;
			}
			.test_title{
				margin-top: 40rpx;font-size: 30rpx;
			}
			.test_warp{
				margin: 80rpx 0;
				.test_card{
					margin: auto;
					border: 1px solid #333;
					width: 80%;
					max-width: 600rpx;
					border-radius: 4rpx;
					font-size: 28rpx;
					
					.test_card_i{
						text-align: left;
						display: flex;
						align-items: inherit;
						margin: 20rpx 0;
						padding: 0 20rpx;
						.test_weigh{
							font-weight: bold;
							color: #333;
							width: 168rpx;
							text-align: right;
						}
						.test_value{
							color: crimson;
							font-size: 30rpx;
						}
					}
					.card_i_2{
						border-top: 1px solid #333;
						padding-top: 20rpx;
					}
				}
				.test_card_btn{
					margin: 80rpx auto 0;
					width: 100%;
					max-width: 600rpx;
					height: 80rpx;
					line-height: 80rpx;
					text-align: center;
					background-color: #1688f1;
					color: #FFF;
					border-radius: 4rpx;
					font-size: 30rpx;
				}
				.test_card_btn2{
					background-color: #5ac725;
					border: 1px solid #5ac725;
					color: #fff;
				}
			}
			
		}
	}
</style>